﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EZCRS.HCMS.Entity;
using EZCRS.HCMS.Data;

namespace EZCRS.HCMS.SqlClient
{
    public class sql_hcrs_aircode
    {
        public List<HCRS_Aircode> getallitem(string cityword)
        {
            string sqlstr = "select * from HCRS_Aircode";
            if (cityword != "")
                sqlstr += " where code like '%"+cityword+"%' or name_e like '%"+cityword+"%' or name like '%"+cityword+"%'";

            return ExecSql.GetTableList<HCRS_Aircode>(sqlstr);
        }

        public HCRS_Aircode getitem(string code)
        {
            try
            {
                return ExecSql.GetTableList<HCRS_Aircode>("select * from HCRS_Aircode where code='" + code + "'")[0];
            }
            catch { return null; }
        }

        public bool deleteitem(int id)
        {
            return false;
        }

        public bool insertorupdate(HCRS_Aircode _aircode)
        {
            return ExecSql.InsertOrUpdateData<HCRS_Aircode>(_aircode);
        }

    }
}
